﻿//https://www.nowcoder.com/practice/f094aed769d84cf3b799033c82fc1bf6?tpId=182&tqId=34710&ru=/exam/oj
class StringFormat {
public:
    string formatString(string A, int n, vector<char> arg, int m) {
        string result;
        size_t i = 0;   // 用于遍历原始字符串 A
        size_t argIndex = 0; // 用于遍历参数字符数组 arg

        while (i < A.size()) {
            // 查找占位符
            if (i < A.size() - 1 && A[i] == '%' && A[i + 1] == 's') {
                // 找到占位符 %s, 使用参数字符替换它
                result += arg[argIndex];
                argIndex++;
                i += 2; // 跳过占位符
            }
            else {
                result += A[i];
                i++;
            }
        }

        // 添加剩余的参数字符
        while (argIndex < arg.size()) {
            result += arg[argIndex];
            argIndex++;
        }

        return result;
    }
};

//https://www.nowcoder.com/questionTerminal/99fa7be28d5f4a9d9aa3c98a6a5b559a

#include <iostream>  
#include <vector>  
#include <cmath>  
#include <string> 

using namespace std;

bool isPrime(int n) {
    if (n < 2) return false;
    if (n == 2) return true;
    if (n % 2 == 0) return false;
    for (int i = 3; i <= sqrt(n); i += 2) {
        if (n % i == 0) return false;
    }
    return true;
}

// 判断给定的数是否为神奇数  
bool isMagicalNumber(int num) {
    string strNum = to_string(num);
    int len = strNum.length();

    // 遍历所有不同位置的两个数字  
    for (int i = 0; i < len; ++i) {
        for (int j = 0; j < len; ++j) {
            if (i != j) {
                // 生成两位数  
                int twoDigitNum = (strNum[i] - '0') * 10 + (strNum[j] - '0');
                // 检查是否为质数且不含前导0  
                if (twoDigitNum >= 10 && isPrime(twoDigitNum)) {
                    return true;
                }
            }
        }
    }
    return false;
}

// 计算区间内的神奇数个数  
int countMagicalNumbers(int a, int b) {
    int count = 0;
    for (int num = a; num <= b; ++num) {
        if (isMagicalNumber(num)) {
            count++;
        }
    }
    return count;
}

int main() {
    int a, b;
    cin >> a >> b;
    int result = countMagicalNumbers(a, b);
    cout << result << endl;
    return 0;
}


#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int a, b;
bool isprim(int n) // 判断是否是质数
{
    if (n < 2) return false;
    for (int i = 2; i <= sqrt(n); i++) // 试除法
    {
        if (n % i == 0) return false;
    }
    return true;
}
int check(int n) // 判断是否是神奇数
{
    vector<int> num;
    while (n)
    {
        num.push_back(n % 10);
        n /= 10;
    }
    for (int i = 0; i < num.size(); i++) // 枚举⼗位数
    {
        for (int j = 0; j < num.size(); j++) // 枚举个位数
        {
            if (i != j && num[i] != 0)
            {
                if (isprim(num[i] * 10 + num[j]))
                {
                    return 1;
                }
            }
        }
    }
    return 0;
}
int main()
{
    cin >> a >> b;
    int ret = 0;
    for (int i = max(a, 10); i <= b; i++)
    {
        ret += check(i);
    }
    cout << ret << endl;
    return 0;
}

//https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a?tpId=37&tqId=21286&ru=/exam/oj

#include <iostream>
#include <string>
using namespace std;
string s;
int x;
int main() {
    cin >> s >> x;
    int begin = -1; // 标记结果的起始位置
    int maxCount = 0; // 存储之前的窗⼝⾥⾯ C + G 的个数
    int count = 0; // 统计窗⼝内 C + G
    int left = 0, right = 0, n = s.size();
    while (right < n) {
        if (s[right] == 'C' || s[right] == 'G') count++;
        while (right - left + 1 > x) {
            if (s[left] == 'C' || s[left] == 'G') count--;
            left++;
        }
        if (right - left + 1 == x) {
            if (count > maxCount) {
                begin = left;
                maxCount = count;
            }
        }
        right++;
    }
    cout << s.substr(begin, x) << endl;
    return 0;
}
